import bus from '@/bus'
import { renderButton } from '@/util';
let data = {
	status: 'pass',
	totalItem: 1,
	pageSize: window.$pageSize,
	currentPage: 1,
	columns: [{
		title: '姓名',
		key: 'realName',
		align: 'left',
    minWidth: 150
	}, {
		title: 'E-mail',
		key: 'email',
		align: 'left',
    minWidth: 200
	}, {
		title: '手机号',
		key: 'mobile',
		align: 'left',
    minWidth: 150
	}, {
		title: '部门',
		key: 'department',
		align: 'left',
    minWidth: 200
	}, {
		title: '最后登录',
		key: 'loginDate',
		align: 'left',
    minWidth: 200
	}, {
		title: '最后登录IP',
		key: 'loginIp',
		align: 'left',
    minWidth: 150
	}, {
		title: '状态',
		align: 'left',
		key: 'isEnabled',
    minWidth: 150,
		render: (h, params) => {
			let state = ''
			if (params.row.isEnabled) {
				state = '启用'
			} else {
				state = '禁用'
			}
			return h('div', state)
		}
	}, {
		title: '创建时间',
		key: 'createDate',
		align: 'left',
    minWidth: 200
	}, {
		title: '操作',
		align: 'right',
		minWidth: 150,
		render: (h, params) => {
			return (
				<div>
					{ renderButton(h, { text: '编辑', type: 'primary',  disabled: params.row.isMaster,},
						()=>{ bus.$emit("onEdit", { id: params.row.id  })})}
					{ renderButton(h, { text: '删除', type: 'warning', disabled: params.row.isMaster || params.row.isLocked ? true : false,},
						()=>{ bus.$emit("onDelete", params.row.id, params.row.realName)})}
				</div>
			)
		}
	}],
	data: []
}
export default data